<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>js检测数据类型的方法</title>
</head>
<body>
<script>
//    null boolean undefined string number object
    /*1.第一种：constructor测试*/
    var object = {a:1,b:2};
    var array = [1,2];
    var string = "testjs";
    var num = 1;
    console.log(object.constructor == Object);
    console.log(array.constructor == Array);
    console.log(string.constructor == String);

    console.log(Object.prototype.toString.call(num));
</script>
</body>
</html>